<?php
class interfaces extends database{
// add ------
	public function Add($name, $content){				
		if(!$this->isChar($name)){
			return 2;
		}else if(!$this->isText($content)){
			return 4;
		}else{			
			$sql="insert into interfaces(name, content) values('".$name."', N'".$content."')";		
			if($result=$this->query($sql)){
				return 1;
			}else{
				return 0;
			}
			return -1;
		}
	}
// edit ------
	public function Edit($name, $content){				
		if(!$this->isChar($name)){
			return 2;
		}else if(!$this->isText($content)){
			return 4;
		}else{			
			echo $sql="update interfaces set content=N'".$content."' where name='".$name."'";		
			if($result=$this->query($sql)){
				return 1;
			}else{
				return 0;
			}
			return -1;
		}
	}
// get by id
	public function GetByName($name){	
		if(!$this->isChar($name)){
			return 2;
		}else{	
			$sql="select name, content from interfaces where name='".$name."'";
			if($result=$this->query($sql)){
				if($this->CountRow($result)>0){
					while(($a=$this->fetch($result))!=NULL){
						$ds_sp[]=$this->unvalid($a); 
					}
					return $ds_sp;		
				}else{
					return 1;
				}
			}
		}
		return 0;
	}
// get all
	public function GetByAll(){			
		$sql="select name, content from interfaces ";
		if($result=$this->query($sql)){
			if($this->CountRow($result)>0){
				while(($a=$this->fetch($result))!=NULL){
					$ds_sp[]=$this->unvalid($a); 
				}
				return $ds_sp;		
			}else{
				return 1;
			}
		}
		return 0;
	}
}
?>